<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>02 Math的方法.html</title>
</head>

<body>


    <script>
        // 1Math.PI  返回圆周率
        // console.log('圆周率：'， Math.PI);

        // Math.abs(x)绝对值
        var a = -100;
        var c = Math.abs(a);
        console.log('C:', c);

        // Math.ceil 对数进行向上取整
        var a = 6.8;
        var b = 6.01;
        var c = 6.0;
        console.log('a:', Math.ceil(a)); //7
        console.log('b:', Math.ceil(b)); //7
        console.log('c:', Math.ceil(c)); //6

        // Math.ceil 对数进行向下取整
        var a = 6.8;
        var b = 6.01;
        console.log('a:', Math.floor(a)); //6
        console.log('b:', Math.floor(b)); //6

        // Math.round 4舍5入
        var a = Math.round(1.1);
        var b = Math.round(1.5);
        var c = Math.round(1.9);
        console.log('a:', a);
        console.log('b:', b);
        console.log('c:', c);

        // Math.max(a, b, c, d); 最大值  Math.min(a,b,c,d,e) 最小值
        var max = Math.max(1, 3, 5, 9, 100, 50);
        console.log('max:', max);

        var x = 2;
        var y = 3;
        var result = Math.pow(x, y);
        console.log('pow:', result);

        // 8. Math.sqrt(x)平方根
        var c = Math.sqrt(16);
        console.log()
    </script>
</body>

</html>